package com.enba.mall.core.shopping.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.enba.mall.core.shopping.entity.ShoppingCart;
import com.enba.mall.core.shopping.entity.ShoppingCartItem;
import com.enba.mall.core.shopping.req.SelectAllRequest;
import com.enba.mall.core.shopping.resp.ShoppingCartResp.ShoppingCartItemResp;
import com.enba.mall.core.shopping.resp.SkuByItemIdResp;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;

public interface ShoppingCartService extends IService<ShoppingCart> {

  /** 获取用户购物车列表 */
  List<ShoppingCartItemResp> getCartList(Long userId);

  /** 添加商品到购物车 */
  Boolean addToCart(Long userId, Long productId, Long skuId, Integer quantity);

  /** 更新购物车商品数量 */
  Boolean updateCartItemQuantity(Long userId, Long itemId, Integer quantity);

  /** 删除购物车商品 */
  Boolean deleteCartItems(Long userId, List<Long> itemIds);

  /** 全选/取消全选购物车商品 */
  Boolean selectOrUnselectAll(Long userId, boolean selected);

  /** 计算购物车总价 */
  BigDecimal calculateTotalPrice(List<ShoppingCartItem> cartItems);

  /** 勾选取消商品 */
  Boolean selectOrUnselect(SelectAllRequest request, Long userId);

  /** 根据购物车项获取商品信息 */
  List<SkuByItemIdResp> getProductInfo(Set<Long> itemIds, Long userId);
}
